Option Strict On
Option Explicit On

Friend MustInherit Class cRadialDistanceSurveySequence

    Protected pSequence As List(Of cRadialSurveyRange)
    Protected pStepSize As Double

    Protected Sub New()

        pSequence = New List(Of cRadialSurveyRange)

    End Sub

    Friend ReadOnly Property StepSize() As Double
        Get
            Return pStepSize
        End Get
    End Property

    Friend ReadOnly Property CountOfSteps() As Integer
        Get
            CountOfSteps = pSequence.Count
        End Get
    End Property

    Friend ReadOnly Property RangeBySequenceIndexBaseOne(ByVal Index As Integer) As cRadialSurveyRange
        Get
            Return pSequence.Item(Index - 1)
        End Get
    End Property

End Class

Friend Class cRadialSurveyRange

    Private pInnerLimit As Double
    Private pOuterLimit As Double

    Friend Sub New(ByVal InnerLimit As Double, ByVal OuterLimit As Double)
        pInnerLimit = InnerLimit
        pOuterLimit = OuterLimit
    End Sub

    Friend ReadOnly Property InnerLimit() As Double
        Get
            Return pInnerLimit
        End Get
    End Property

    Friend ReadOnly Property OuterLimit() As Double
        Get
            Return pOuterLimit
        End Get
    End Property

End Class

Friend Class cRadialDistanceSurveySequenceInnerIncreasing

    Inherits cRadialDistanceSurveySequence

    Public Sub New(ByVal InnerLowerLimit As Double, ByVal InnerUpperLimit As Double, ByVal OuterLimit As Double, ByVal StepCount As Integer)

        MyBase.New()

        Dim InnerLimit As Double

        Debug.Assert(StepCount >= 0)

        If InnerUpperLimit <= InnerLowerLimit Then
            StepCount = 0
            InnerLowerLimit = InnerUpperLimit
        End If

        If StepCount = 0 Then
            pSequence.Add(New cRadialSurveyRange(InnerLowerLimit, OuterLimit))
            pStepSize = 0 'InnerUpperLimit - InnerLowerLimit
        Else
            pStepSize = (InnerUpperLimit - InnerLowerLimit) / StepCount
            Debug.Assert(pStepSize > 0)
            For InnerLimit = InnerLowerLimit To InnerUpperLimit Step StepSize
                pSequence.Add(New cRadialSurveyRange(InnerLimit, OuterLimit))
            Next
        End If

    End Sub

End Class


Friend Class cRadialDistanceSurveySequenceOuterIncreasing

    Inherits cRadialDistanceSurveySequence

    Public Sub New(ByVal InnerLimit As Double, ByVal OuterLowerLimit As Double, ByVal OuterUpperLimit As Double, ByVal StepCount As Integer)

        MyBase.New()

        Dim OuterLimit As Double

        Debug.Assert(StepCount >= 0)

        If OuterLowerLimit >= OuterUpperLimit Then
            StepCount = 0
            OuterUpperLimit = OuterLowerLimit
        End If

        If StepCount = 0 Then
            pSequence.Add(New cRadialSurveyRange(InnerLimit, OuterUpperLimit))
            pStepSize = 0 'OuterUpperLimit - InnerLimit
        Else
            pStepSize = (OuterUpperLimit - OuterLowerLimit) / (StepCount)
            Debug.Assert(pStepSize > 0)
            For OuterLimit = OuterLowerLimit To OuterUpperLimit Step pStepSize
                pSequence.Add(New cRadialSurveyRange(InnerLimit, OuterLimit))
            Next
        End If

    End Sub

End Class

